package cen.tms.ggtour;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import cen.tms.ggtour.data.DataManager;

public class GGTourHome extends Activity {
	Button previewTour;
	Button campusMap;
	Button events;
	Button createTour;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ggtour);
        previewTour = (Button)findViewById(R.id.bPreviewTour);
        campusMap = (Button)findViewById(R.id.bCampusMap);
        events = (Button)findViewById(R.id.bEvents);
        createTour = (Button)findViewById(R.id.bCreateTour);
        
        TextView title = (TextView) findViewById(android.R.id.title);
        Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/book_antiqua.ttf");
        title.setTypeface(tf);
        title.setText("Guided Tour");
        
        
        previewTour.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent openPreviewTour = new Intent("cen.tms.ggtour.PREVIEWTOUR");
				
				startActivity(openPreviewTour);
			}
		});
        
        campusMap.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				Intent openCampusMap = new Intent("cen.tms.ggtour.CAMPUSMAP");
				startActivity(openCampusMap);
			}
		});
        
        events.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent openEvents = new Intent("cen.tms.ggtour.EVENTS");
				startActivity(openEvents);
			}
		});
        createTour.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View v) { 
        			showDialog(0);
     			}
     		});
    }
    
	@Override
	protected Dialog onCreateDialog(int id) {
		Dialog beta = null;
		switch(id){		
			default:
				beta = new Dialog(this);
				beta.setContentView(R.layout.beta);
				break;
		}
		return beta;
	}

	@Override
	protected void onDestroy() {
		DataManager.getInstance(this).close();
		super.onDestroy();
	}
    
}